package com.weibo4j.api.req.comment;

import java.util.Arrays;
import java.util.List;

import com.weibo4j.api.WeiboRequest;
import com.weibo4j.api.annotation.Param;
import com.weibo4j.api.response.comment.CommentBatchResponse;
import com.weibo4j.api.util.RequestType;


public class CommentBatchGetRequest extends WeiboRequest<CommentBatchResponse>{

    private String source;
    
    private String accessToken;
    
    private List<String> cidList;
    
    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    @Param("access_token")
    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public void setCidList(List<String> cidList) {
        this.cidList = cidList;
    }

    public List<String> getCidList() {
        return cidList;
    }

    public String getCids() {
        if (cidList != null && !cidList.isEmpty()) {
            String ids = Arrays.toString(cidList.toArray(new String[cidList.size()]));
            return ids.substring(1, ids.length() - 1);
        } else {
            return null;
        }
    }
    
    @Override
    public String baseUrl() {
        return "https://api.weibo.com/2/comments/show_batch.json";
    }

    @Override
    public RequestType requestType() {
        return RequestType.GET;
    }

    @Override
    public Class<CommentBatchResponse> responseType() {
        return CommentBatchResponse.class;
    }

}
